/**
 * creater:chuanpeng.zhu
 * create time:2016/05/27
 * describe：用户操作服务。用于用户信息的存储。调用等。
 **/
/*接口地址管理 */
APP
    .service('UrlService', [function () {
        var servers = [
            {//开发环境
                dataServer: 'http://47.94.130.122/',
                imageServer: 'http://172.16.63.99:3000',
                uploadImageServer: 'http://172.16.63.99:3000/uploadImage',
                payServer: ''
            }, {//开发调试环境
                dataServer: 'http://172.24.1.119:8089',
                imageServer: 'http://172.24.1.119:8089',
                uploadImageServer: 'http://172.24.1.119:8089',
                payServer: ''
            }, {//测试环境
                dataServer: 'http://47.94.130.122/',
                imageServer: '',
                uploadImageServer: '',
                payServer: ''
            }, {//生产环境
                dataServer: 'http://xiaohui.safebox.net.cn',
                imageServer: 'http://xiaohui.safebox.net.cn',
                uploadImageServer: 'http://xiaohui.safebox.net.cn',
                payServer: ''
            }];

        var urls = [
            {
                /* 登录 START */
                LOGIN: 'api/login', //首页获取轮播广告列表
                TYPE_LIST:'api/dictionary',//数据类型
                QUERY_BARCODE:'api/material/querybybarcode',//按条码查询物料信息
                QUERY_AXLE:'api/material/querybyaxle/{axle}',//按轴序查询物料信息
                IN_STOCK:'api/material/instock',//入库
                OUT_STOCK:'api/material/outstock',//出库
                ON_LINE:'api/material/online',//上线
                OFF_LINE:'api/material/offline',//下线
                GET_LOCUS: '/data/Locus.json'
                /* 登录 END */
            }, {}, {}, {}];

        this.getUrl = function (param) {
            return (servers[CONFIG.environment]['dataServer'] + urls[CONFIG.environment][param]);
        };

        this.getImageUrl = function (param) {
            return (servers[CONFIG.environment]['imageServer'] + param);
        };

        this.getUploadImageServer = function () {
            return (servers[CONFIG.environment]['uploadImageServer']);
        };

        this.getServer = function (param) {
            return servers[CONFIG.environment][param];
        }

    }])
;

